Skip to main content

IndexApi

A class for interfacing with the Vecto Index API.

Methods:

indexData

async indexData(requestParameters: IndexDataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<IndexResponse>

Create an entry in the index for Image or Text data and store them in the provided vector space.

Args:

  • requestParameters (IndexDataRequest): Parameters for the index data request.
    • vectorSpaceId: The ID of the vector space to index in (required).
    • modality: The modality of the data.
    • attributes: Array of attributes.
    • input: Array of input data.
  • initOverrides (RequestInit or runtime.InitOverrideFunction): Overrides for the request initialization.

Returns:

  • IndexResponse: Response of the index data operation.
    • status: Status of the index operation
    • ids: Array containing the unique IDs of the indexed data items.
import { Configuration, IndexApi, IndexDataRequest, Modality } from 'vecto-sdk'

const config = new Configuration({
accessToken: 'your-token'
});

const api = new IndexApi(config);

const textDataParams: IndexDataRequest = {
vectorSpaceId: 'your-vector-space-id',
modality: 'TEXT',
attributes: [JSON.stringify('sample metadata')],
input: [new Blob(['sample data to vectorize and ingest'])],
};

const responseText = await api.indexData(textDataParams);